home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Source Code / Visual Basic Source Code.iso / vbsource / hugstr / hstrcat.c < prev    next >
Encoding:
C/C++ Source or Header  |  1992-09-10  |  1.5 KB  |  68 lines

  1. /*
  2.   File Name..:  hstrcat.c
  3.   Date.......:  1-15-1992
  4.   Author.....:  Steve Seale  ARCO Oil & Gas Co.  76100,2755
  5.  
  6.   Built using QuickC and the C700 libraries.
  7. */
  8.  
  9. #define NOCOMM
  10. #include <windows.h>
  11. #include <memory.h>
  12.  
  13. #include "hugearr.h"
  14.  
  15. /* Concat a huge string (string can go past seg. boundary)  */
  16. /*
  17. DECLARES for VISUAL BASIC:
  18. Declare Function VBHugeStrCat Lib "HUGEARR.DLL" (ByVal lptr As Any, ByVal roww As String) As Long
  19. Declare Function VBHugeStrEnd Lib "HUGEARR.DLL" (ByVal hMem As Integer) As Long
  20. Declare Function VBHugeLock Lib "HUGEARR.DLL" (ByVal hMem%) As Long
  21. */
  22.  
  23. HPBYTE FAR PASCAL
  24. VBHugeStrCat(HPBYTE hpPtr, LPBYTE lpBuffer)
  25.     {
  26.     LONG      lBufLen;   /* length of passed string */
  27.  
  28.     /* get length of buffer */
  29.     lBufLen = (LONG) lstrlen(lpBuffer);
  30.  
  31.     /* copy data */
  32.     hmemcpy(hpPtr, lpBuffer, lBufLen );
  33.  
  34.     /*  point to end of buffer */
  35.     hpPtr += lstrlen(lpBuffer);
  36.     *(hpPtr + 1) = NULL;  /* put NULL at end */
  37.  
  38.     return hpPtr;
  39.  
  40.     }
  41.  
  42.    /*  Find the end of a huge string and return the pointer to it */
  43. HPBYTE FAR PASCAL
  44. VBHugeStrEnd(HANDLE hMem)
  45.     {
  46.     HPBYTE    hPtr;   /* pointer to huge string buffer */
  47.  
  48.     /* get starting address */
  49.     hPtr = (HPBYTE) GlobalLock(hMem);
  50.  
  51.     /* find end of huge string */
  52.     while (*hPtr != NULL)
  53.         hPtr = hPtr + 1;
  54.  
  55.     return hPtr;
  56.  
  57.     }
  58.  
  59. /*  return a huge pointer from GlobalLock
  60.         (ie. GlobalLock only returns a FAR pointer .. with no segment stuff, see Petzold)
  61. */
  62. HPBYTE   FAR PASCAL VBHugeLock(HANDLE hMem)
  63.     {
  64.  
  65.      return (HPBYTE) GlobalLock(hMem);
  66.  
  67.     }
  68.